package Datastruct.Graph;

public class Test {
    public static void main(String[] args) {
        Graph graph = new Graph(5);
        String[] vertexs = {"A", "B", "C", "D", "E"};
        for (String v : vertexs) {
            graph.insertVertex(v);
        }
        //插入边
        graph.insertEdges(0, 1, 1);
        graph.insertEdges(0, 2, 1);
        graph.insertEdges(1, 2, 1);
        graph.insertEdges(1, 3, 1);
        graph.insertEdges(1, 4, 1);

        graph.showList();

        //深度优先
//        graph.dfs();

        //广度优先
        graph.bfs();
    }
}
